package com.aitesting.testcase;

import com.aitesting.domain.TConfig;
import lombok.Data;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 填充基本配置
 */
@Data
public class Config {
    private final String name;
    private String base_url;
    private Map<String,Object> variables= new HashMap<>();

    public Config(String name){
        this.name = name;
        this.variables = new HashMap<>();
    }
    public Config variables(Map<String, Object> variables){
        this.variables.putAll(variables);
        return this;
    }

    public Config base_url(String base_url){
        this.base_url = base_url;
        return this;
    }

    // 真正存储配置信息的对象
    public TConfig perform(){
        TConfig config = new TConfig();
        config.setName(this.name);

        config.setVariables(this.variables);
        config.setBase_url(this.base_url);
        return config;
    }
}
